from pms.common.views import PostFormula
from user.utils.login import get_user_by_uid
from user.utils.profile import user_view


class API(PostFormula):
    def handle(self, req):
        uid = req.get('id')
        if uid is not None:
            user = get_user_by_uid(uid)
        else:
            user = self.user
        return self.success_respond(user_view(user))
